package com.stack.example;

import javax.imageio.metadata.IIOMetadataFormatImpl;
import javax.swing.text.TabStop;

public class Stack {
	private int top = 0;
	private String[] stackArr = new String[5];


	public void push(String num) {
		stackArr[top]=num;
		top++;
	}


	public void out() {
		String item=stackArr[top-1];
		System.out.println("��ջ������"+item);
		stackArr[top-1]=null;
		top--;
	}


	public void printStackArr() {
		for (int i = 0; i < stackArr.length; i++) {
			String item = stackArr[i];
	
			if(item==null) {
				break;
			}
			System.out.print(item+" ");
			
		}
		System.out.println();
	}


	public void clear() {
		while (top>0) {
			out();
		}
	}

}
